<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@include file="/context/mytags.jsp" %>
<div class="easyui-layout" fit="true" id="main_ad_list">
    <div region="center" style="padding:1px;">
        <t:datagrid name="sResultList" title="" actionUrl="csResultController.do?datagrid&dimId=${dimEntity.id}" idField="id" fit="true"
                    queryMode="group" pagination="false">
            <t:dgCol title="主键" field="id" hidden="true"></t:dgCol>
            <t:dgCol title="结果名称" field="name" width="3" query="true"></t:dgCol>
            <t:dgCol title="开始分数" field="beginScore" width="1"></t:dgCol>
            <t:dgCol title="结束分数" field="endScore" width="1" ></t:dgCol>
            <%--<t:dgCol title="创建时间" field="createTime" width="1" query="true"></t:dgCol>--%>

            <t:dgCol title="common.operation" field="opt"></t:dgCol>
            <t:dgDelOpt url="csResultController.do?del&id={id}" title="删除"></t:dgDelOpt>

            <t:dgToolBar title="新增" icon="icon-add" url="csResultController.do?addorupdate&dimId=${dimEntity.id}" funname="add" width="600"
                         height="550"></t:dgToolBar>
            <t:dgToolBar title="修改" icon="icon-edit" url="csResultController.do?addorupdate" funname="f_updateInfo"
                         width="600" height="550"></t:dgToolBar>
            <t:dgToolBar title="预览" icon="icon-search" url="csResultController.do?detail" funname="f_detail" width="600"
                         height="550"></t:dgToolBar>

        </t:datagrid>
    </div>
</div>

<script type="text/javascript">
    function f_updateInfo(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择编辑分析结果');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一条分析结果再编辑');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createwindow(title, url, width, height);
    }

    function f_detail(title, url, id, width, height) {
        gridname = id;
        var rowsData = $('#' + id).datagrid('getSelections');
        if (!rowsData || rowsData.length == 0) {
            tip('请选择分析结果');
            return;
        }
        if (rowsData.length > 1) {
            tip('请选择一条分析结果再查看');
            return;
        }

        url += '&id=' + rowsData[0].id;
        createdetailwindow(title, url, width, height);
    }
</script>
